package cn.gson.crm.controller.delete;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.StudentDao;
import cn.gson.crm.model.entity.Student;

/**
 * 显示删除学生
 */
@WebServlet("/show/delete/stu")
public class ShowDeleteStu extends BaseServlet {
	private static final long serialVersionUID = 1L;
	private StudentDao stuDao = new StudentDao();
       
    @Override
    protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
    	super.get(request, response);
    	String name = request.getParameter("userName");
    	String p = request.getParameter("page");
    	
    	if(p == null || p.isEmpty()){
    		p = "1";
    	}
    	
    	Integer page = Integer.parseInt(p);
    	List<Student> stuList = stuDao.getPageStuByStaAndAll("删除", page, name);
    	int totalPage = stuDao.getTotalPage("删除", name);
    	request.setAttribute("stuList", stuList);
    	request.setAttribute("totalPage", totalPage);
    	request.setAttribute("page", page);
    	getServletPathAndForward(request, "delete/delete_stu.jsp");
    }

}
